package com.example.hissys.service;

import com.example.hissys.entity.Department;
import com.example.hissys.mapper.DepartmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.util.List;

/**
 * 科室服务层
 */
@Service
@Slf4j
public class DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;

    /**
     * 根据医院ID获取科室列表
     * @param hospitalId 医院ID
     * @return 科室列表
     */
    public List<Department> getDepartmentsByHospitalId(Integer hospitalId) {
        log.info("Fetching departments for hospital ID: {}", hospitalId);
        return departmentMapper.findByHospitalId(hospitalId);
    }

    /**
     * 根据ID获取部门详情
     * @param id 部门ID
     * @return 部门信息
     */
    public Department getDepartmentById(Integer id) {
        log.info("Fetching department details for ID: {}", id);
        return departmentMapper.findById(id);
    }
} 